package cn.taoticket.service;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


import cn.taoticket.mapper.TaoticketUserMapper;
import cn.taoticket.pojo.TaoticketUser;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by taoticket
 */
@RestController
public class RestTaoticketUserService {

     @Resource
     private TaoticketUserMapper taoticketUserMapper;

     @RequestMapping(value = "/getTaoticketUserById",method = RequestMethod.POST)
     public TaoticketUser getTaoticketUserById(@RequestParam("id") Long id)throws Exception{
        return taoticketUserMapper.getTaoticketUserById(id);
     }

     @RequestMapping(value = "/getTaoticketUserListByMap",method = RequestMethod.POST)
     public List<TaoticketUser>	getTaoticketUserListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketUserMapper.getTaoticketUserListByMap(param);
     }

     @RequestMapping(value = "/getTaoticketUserCountByMap",method = RequestMethod.POST)
     public Integer getTaoticketUserCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketUserMapper.getTaoticketUserCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddTaoticketUser",method = RequestMethod.POST)
     public Integer qdtxAddTaoticketUser(@RequestBody TaoticketUser taoticketUser)throws Exception{
        taoticketUser.setCreatedTime(new Date());
        return taoticketUserMapper.insertTaoticketUser(taoticketUser);
     }

     @RequestMapping(value = "/qdtxModifyTaoticketUser",method = RequestMethod.POST)
     public Integer qdtxModifyTaoticketUser(@RequestBody TaoticketUser taoticketUser)throws Exception{
        taoticketUser.setUpdatedTime(new Date());
        return taoticketUserMapper.updateTaoticketUser(taoticketUser);
     }
    @RequestMapping(value = "/checkLoginByPassword",method = RequestMethod.POST)
    public TaoticketUser checkLoginByPassword(@RequestBody TaoticketUser taoticketUser)throws Exception{
        return taoticketUserMapper.checkLoginByPassword(taoticketUser.getPhone(),taoticketUser.getPassword());
    }
}
